import axios from 'axios';
import Qs from 'qs';

const fetch = axios.create({
  baseURL: '/',
  headers: {'X-Requested-With': 'XMLHttpRequest'},
  paramsSerializer: params => Qs.stringify(params, {arrayFormat: 'brackets'}),
});


// 添加请求拦截器
fetch.interceptors.request.use(
  config => config,
  error => Promise.reject(error)
);

export const get = fetch.get;

export const post = fetch.post;
